package com.neuedu.spring.live;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.InstantiationAwareBeanPostProcessor;

public class MyBean  implements InstantiationAwareBeanPostProcessor {

    private String name;

    public MyBean() {
        System.out.println("MyBean.对象的构造");
    }

    public void setName(String name) {
        this.name = name;
        System.out.println("先设置[MyBean]的setName属性");
    }

    public String getName() {
        return name;
    }



    public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
        System.out.println("【MyInstantiationAwareBeanPostProcessor】.postProcessBeforeInitialization");
        return bean;
    }

    public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
        System.out.println("【MyInstantiationAwareBeanPostProcessor】.postProcessAfterInitialization");
        return bean;
    }
}
